package com.ma.table.actors.botones;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.ma.logica.Assets;
import com.ma.logica.Constantes;
import com.ma.logica.Sonido;

public class BotonSonido extends Actor {
	
	public TextureRegion[][] tmp;
	public TextureRegion texturaFinalBoton;
    private Texture botonTexture;
	
	public BotonSonido() {
		setHeight(Constantes.TAMANIO_BOTON_SONIDO_H);
		setWidth(Constantes.TAMANIO_BOTON_SONIDO_W);
		setPosition(Constantes.POSICON_X_BOTON_SONIDO, Constantes.POSICON_Y_BOTON_SONIDO);
		
		botonTexture = Assets.instance.images.sonidoTexture;
        tmp = TextureRegion.split(botonTexture, botonTexture.getWidth()/2, botonTexture.getHeight() );
	}
	
	 @Override
	 public void draw(Batch batch,float parentAlpha){
		 if(Sonido.mute){
			 texturaFinalBoton = tmp[0][0];
		 }else{
			 texturaFinalBoton = tmp[0][1];
		 }
		 batch.draw(texturaFinalBoton, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(), getRotation());
		 batch.flush();
	 }
	 
		public TextureRegion[][] getTmp() {
			return tmp;
		}

		public void setTmp(TextureRegion[][] tmp) {
			this.tmp = tmp;
		}

		public TextureRegion getTexturaFinalBoton() {
			return texturaFinalBoton;
		}

		public void setTexturaFinalBoton(TextureRegion texturaFinalBoton) {
			this.texturaFinalBoton = texturaFinalBoton;
		}
}
